package com.ds.infrastructure.hyperspace.console.model.response.result;

import com.ds.infrastructure.hyperspace.console.enums.JsonResultCodeEnum.SUCCESS;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;


/**
 * Created by Administrator on 2016/10/20.
 */
@ApiModel(value = "返回类")
public class JsonResultData<T> extends JsonResult {

    private JsonResultData(T data) {
        super(SUCCESS.OK.code, SUCCESS.OK.message);
        this.setData(data);
    }

    @ApiModelProperty(value = "返回对象")
    private T data;

    public T getData() {
        return data;
    }

    private void setData(T data) {
        this.data = data;
    }

    public static <T> JsonResultData build(T data) {
        return new JsonResultData(data);
    }

    public static JsonResultData buildEmpty() {
        return new JsonResultData(null);
    }
}
